﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Caching;
using System.Text;
using System.Threading.Tasks;
using YetAnotherChat.MemoryStorage.Interfaces;

namespace YetAnotherChat.MemoryStorage.Imp
{
    /// <summary>
    /// Temp cache, supposed to change to Memcache
    /// </summary>
    public class DefaultCache: ICache
    {
        private MemoryCache _cache;

        public DefaultCache()
        {
            _cache = new MemoryCache("DefaultCache");
        }

        public void Insert(string key, object value)
        {
            _cache.Add(key, value, null);
        }

        public void Remove(string key)
        {
            _cache.Remove(key);
        }


        public object Get(string key)
        {
            return _cache.Get(key);
        }
    }
}
